package myFile;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

/**
 * @author gao
 * @date 2025/8/10 15:09
 */

public class Demo3 {
    public static void main(String[] args) throws IOException {
        File file1 = new File("./test.txt");
        if (!file1.exists()) {
            file1.createNewFile();
        }
        Scanner in = new Scanner(System.in);
        System.out.println("请输入任意内容：");
        in.next();
        File file2 = new File("./test2.txt");
        file1.renameTo(file2);// 重命名文件名称
    }
}